import 'package:fluro/fluro.dart';
import 'package:mi_mang_flutter/page/setting/common/introduce_page.dart';
import 'about_page.dart';
import 'account/account_page.dart';
import 'account/email_bind_page.dart';
import 'account/update_password_page.dart';
import 'account/verification_code_page.dart';
import 'common/setting_font_page.dart';
import 'common/setting_font_size_page.dart';
import 'common/theme_page.dart';
import 'common_issue_page.dart';
import 'common/common_setting_page.dart';
import 'common/setting_language_page.dart';
import 'feedback_page.dart';
import 'personal_info/personal_info_page.dart';
import 'setting_page.dart';
import 'package:mi_mang_flutter/routers/router_init.dart';

/// 设置页面路由
class SettingRouter implements IRouterProvider {
  /// 设置
  static String setting = "/setting";

  /// 个人资料
  static String personalInfo = "/personal/info";

  /// 账号与安全
  static String account = "/account";

  /// 账号与安全-邮箱
  static String accountBindEmail = "/account/bind/email";

  /// 账号与安全-输入验证码
  static String accountVerificationCode = "/account/verification/code";

  /// 通用设置
  static String commonSetting = "/common/setting";

  /// 通用设置-语言设置
  static String commonSettingTheme = "/common/setting/Theme";

  /// 通用设置-语言设置
  static String commonSettingLanguage = "/common/setting/Language";

  /// 通用设置-字体设置
  static String commonSettingFont = "/common/setting/font";

  /// 通用设置-字体大小设置
  static String commonSettingFontSize = "/common/setting/fontsize";

  /// 关于
  static String about = "/about";

  /// 功能介绍
  static String introduce = "/about/introduce";

  /// 常见问题
  static String commonIssue = "/common/issue";

  /// 意见反馈
  static String feedback = "/feedback";

  /// 修改密码
  static String updatePassword = "/update/password";

  @override
  void initRouter(FluroRouter router) {
    /// 设置
    router.define(
      setting,
      handler: Handler(handlerFunc: (_, params) => SettingPage()),
    );

    /// 个人资料
    router.define(
      personalInfo,
      handler: Handler(handlerFunc: (_, params) => PersonalInfoPage()),
    );

    /// 账号与安全
    router.define(
      account,
      handler: Handler(handlerFunc: (_, params) => AccountPage()),
    );

    /// 账号与安全-邮箱
    router.define(
      accountBindEmail,
      handler: Handler(handlerFunc: (_, params) => EmailBindPage()),
    );

    /// 账号与安全-输入验证码
    router.define(
      accountVerificationCode,
      handler: Handler(handlerFunc: (_, params) {
        String? email = params["email"]?.first;
        return VerificationCodePage(
          email: email,
        );
      }),
    );

    /// 通用设置
    router.define(
      commonSetting,
      handler: Handler(handlerFunc: (_, params) => CommonSettingPage()),
    );

    /// 通用设置-主题设置
    router.define(
      commonSettingTheme,
      handler: Handler(handlerFunc: (_, params) => ThemePage()),
    );

    /// 通用设置-语言设置
    router.define(
      commonSettingLanguage,
      handler: Handler(handlerFunc: (_, params) => SettingLanguagePage()),
    );

    /// 通用设置-字体设置
    router.define(
      commonSettingFont,
      handler: Handler(handlerFunc: (_, params) => SettingFontPage()),
    );

    /// 通用设置-字体大小设置
    router.define(
      commonSettingFontSize,
      handler: Handler(handlerFunc: (_, params) => SettingFontSizePage()),
    );

    /// 关于
    router.define(
      about,
      handler: Handler(handlerFunc: (_, params) => AboutPage()),
    );

    /// 关于
    router.define(
      introduce,
      handler: Handler(handlerFunc: (_, params) => IntroducePage()),
    );

    /// 常见问题
    router.define(
      commonIssue,
      handler: Handler(handlerFunc: (_, params) => CommonIssuePage()),
    );

    /// 意见反馈
    router.define(
      feedback,
      handler: Handler(handlerFunc: (_, params) => FeedbackPage()),
    );

    /// 修改密码
    router.define(
      updatePassword,
      handler: Handler(handlerFunc: (_, params) => UpdatePasswordPage()),
    );
  }
}
